<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../common/include/header.jsp" %>
<%-- 커뮤니티 검색 페이지 --%>
<div>
<table border="0" cellpadding="0" cellspacing="0" width="980px">
	<tr><td style="vertical-align: top;width: 180px;background-color: #fdb73a;">
	
	<table style="width: 180px;text-align: center;font-weight: bold;" cellpadding="0" cellspacing="0">
	<tr><td style="height: 20px;"><img src="<%=imagePath %>left_01.jpg"/></td></tr>
	<tr><td style="height: 20px;"><img src="<%=imagePath %>left_comm.jpg"/></td></tr>
		<logic:notEmpty name="communityForm" property="memberCommunitys">
			<form name="urlForm">
		<tr><td style="height: 20px;background-image: url('<%=imagePath %>left_02.jpg');padding-top:2px;">
				<select name="url" onchange="changeUrl()" style="width: 140px;height: 18px;font-size: 8pt;">
					<logic:iterate id="mc" name="communityForm" property="memberCommunitys" type="model.MemberCommunity">
						<option value="<bean:write name="mc" property="cono"/>"><bean:write name="mc" property="coname"/></option>
					</logic:iterate>
				</select>
		</td></tr>
			</form>
		</logic:notEmpty>
		<tr><td style="height: 20px;background-image: url('<%=imagePath %>left_02.jpg')">
			<html:link action="/communityinfo.do?method=createForm" styleClass="la">동호회 개설 신청</html:link>
			</td></tr>
		<tr><td style="height: 20px;"><img src="<%=imagePath %>left_03.jpg"/>
			</td></tr>
	</table>	
		</td>
		<td>
		<div style="width: 800px; text-align: center;vertical-align: top;">
			<table style="width: 800px;" cellpadding="0" cellspacing="0">
				<tr><td style="width: 600px;vertical-align: top;">
						<div style="width: 600px;height: 100px;"><img src="<%=imagePath %>comm_banner_s.jpg" border="0"/></div>
						<table style="width: 600px;" cellpadding="0" cellspacing="0">
							<tr>
								<td>
								
<!-- 동호회 검색 표시부 -->
									<table style="width: 560px;" cellpadding="0" cellspacing="0">
										<tr><td style="width: 200px;height: 40px;"><img src="<%=imagePath %>comm_find_01.jpg" border="0"/></td>
											<td style="width: 240px;height: 40px;background-image: url('<%=imagePath %>comm_find_02.jpg');vertical-align: bottom;">
											<input type="text" id="findcn" name="coname"><input type="button" value="Search" onclick="find()" style="border: 1px solid #999999;background: #fdb73a;"></td>
											<td style="width: 120px;height: 40px;"><a href="<%=path%>/community/communityfind.do?method=communityFind&ccno=0&coname=">
												<img src="<%=imagePath %>comm_find_03.jpg"></a></td></tr>
											
											<tr><td colspan="3">
											
												<table style="width: 560px;border: 1px solid #fdb73a;">
												<%int i=0;%>
												<tr>
												<logic:iterate id="sortCommunity" name="communityForm" property="sortCommunity" type="model.Community">													
													<%if(i==4){%>
														</tr><tr>
													<%}%>
													<td style="width: 140px"><a href="<%=path%>/community/communityfind.do?method=communityFind&ccno=<bean:write name="sortCommunity" property="ccno"/>&coname="><bean:write name="sortCommunity" property="ccname"/><span style="font-size: 8pt;">(<bean:write name="sortCommunity" property="ccnocount"/>)</span></a></td>
													<%i++;%>
												</logic:iterate>
												</tr>
												</table>
												
											</td></tr>
									</table>
									
<!-- 동호회 리스트 표시부 -->
						<table style="width: 600px;" cellpadding="0" cellspacing="0">
						
										<logic:empty name="communityForm" property="sortResult">
											<tr><td>검색된 동호회가 없습니다.</td></tr>
										</logic:empty>
										
										<logic:notEmpty name="communityForm" property="sortResult">
											<logic:iterate id="sr" name="communityForm" property="sortResult" type="model.Community">
												<tr><td><div style="height: 5px;"></div>
													
														<table style="width: 560px;border: 1px dotted #fdb73a;">
															<tr><td colspan="2" style="text-align: left;padding-left: 5px;padding-right: 5px;">∴
															<a href="<%=path%>/community/community.do?cono=<bean:write name="sr" property="cono"/>" style="color: olive;font-weight: bold;"><bean:write name="sr" property="coname"/></a></td>
															<td style="text-align: right;"><img src="<%=imagePath %>comm_join.jpg" onclick="comminsert('<bean:write name="sr" property="cono"/>')" onmouseover="javascript:this.style.cursor='hand';"/></td>
															</tr>
															<tr>
																<td style="width: 140px;text-align: left;padding-left: 5px;">회원수 : <bean:write name="sr" property="membercount"/>명</td>

																<td style="width: 140px;text-align: left;padding-left: 5px;">관리자 : <bean:write name="sr" property="mid"/></td>

																<td style="width: 140px;text-align: left;padding-left: 5px;">개설일 : <bean:write name="sr" property="coregdate"/></td></tr>
																
															<tr><td colspan="3" style="text-align: left;padding: 5px;color: #999999;border-top: 1px dotted #dddddd;"><bean:write name="sr" property="coguide"/></td></tr>															
														</table>
													</td></tr>
											</logic:iterate>
										</logic:notEmpty>
										<tr><td>
												<logic:notEmpty name="communityForm" property="findname">
													<jsp:include page="findnamepager.jsp">
														<jsp:param name="url" value="/community/communityfind.do?method=conameFind"/>
													</jsp:include>
												</logic:notEmpty>
												<logic:empty name="communityForm" property="findname">
													<jsp:include page="communitypager.jsp">
														<jsp:param name="url" value="/community/communityfind.do?method=communityFind"/>
													</jsp:include>
												</logic:empty>					
											</td></tr>
									</table>
								</td>
							</tr>
						</table>
						<div style="height: 20px;"></div>
					</td>
					
					<td style="width: 200px; vertical-align: top;"><img src="<%=imagePath %>comm_find.jpg" border="0"/></td>
				</tr>
			</table>		
		</td>
	</tr>
</table>
<script type="text/javascript">
	//커뮤니티 명으로 검색할 때
	function find(){
		var coname = document.getElementById('findcn').value;
		var reconame = coname.replace(/\s/g,'');

		var cn = decodeURIComponent(coname);
		if(reconame != ''){
			location.href = "<%=path%>/community/communityfind.do?method=conameFind&coname="+escape(encodeURIComponent(cn));		
		}else{
			alert('내용을 입력해 주세요');
		}	
	}
	
	//커뮤니티 카테고리별 검색할 때
	function comminsert(cono){
		<%	boolean check = user.isLogon();
			if(check){	%>
				location.href = "<%=path%>/community/communityjoin.do?method=getForm&cono="+cono;
		<%	}else{	%>
				alert("로그인 후 이용가능 합니다.");
	
		<%	}	%>
	}
	
	function changeUrl(){
		var selectedIndex = window.document.urlForm.url.selectedIndex;
		if(selectedIndex==0){}
		else{
			var url=window.document.urlForm.url.options[selectedIndex].value;
			if(url!=0){
				url = '<%=path%>/community/community.do?cono='+url;
				window.open(url,"_self");
			}
		}
	}
</script>
</div>
<%@ include file="../common/include/footer.jsp" %>
